#!/bin/bash

FILE=/etc/security/passwd

USER="${1}:"
sudo cat $FILE | while read l; do
   if [[ $FOUND = true ]]; then
      if [[ $l != "" ]]; then
         FIELD=$(echo $l | awk '{print $1}')
	 if [[ $FIELD == "password" ]]; then
            VALUE=$(echo $l | awk '{print $3}')
            echo "${USER}$VALUE"
         fi
      else
         FOUND=false
      fi
   fi
   if [[ $l = $USER ]]; then
      FOUND=true
   fi
done
exit
